package com.hzhjhh.enums;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.commons.lang3.StringUtils;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 类别枚举
 * 
 * @author 12083
 *
 */
@Getter
@AllArgsConstructor
public enum CategoryEnums {

	WF1000("WF1000", "未分类"),
	SX1001("SX1001", "生鲜类"),
	SP1002("SP1002", "食品类"),
	SG1003("SG1003", "蔬果类"),
	DQ1004("DQ1004", "电器类"),
	RY1005("RY1005", "日用类"),
	LP1006("LP1006", "礼品类"),
	;
	
	private final String code;
	private final String desc;
	
	public static CategoryEnums getByCode(String code) {
		if (StringUtils.isBlank(code)) {
			return WF1000;
		}
		for (CategoryEnums orderIdEnums : CategoryEnums.values()) {
			if (StringUtils.equals(orderIdEnums.getCode(), code)) {
				return orderIdEnums;
			}
		}
		return WF1000;
	}
	
	public static List<String> getDescs() {
		return Stream.of(CategoryEnums.values())
				.map(CategoryEnums::getDesc)
				.collect(Collectors.toList());
	}
}
